<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('导入表结构')" />
</head>
<body class="gray-bg">
    <div class="container-div">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="gen-form">
					<div class="select-list">
						 <input type="hidden" id="setId" th:value="${setId}"/>
						<ul>
							<li>
								名称：<input type="text" name="mingcheng"/>
							</li>
							<li>
								作者：<input type="text" name="zuozhe"/>
							</li>
							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
								<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>
				</form>
			</div>
			
		    <div class="col-sm-12 select-table table-striped">
			    <table id="bootstrap-table"></table>
			</div>
		</div>
	</div>
	<th:block th:include="include :: footer" />
	<script type="text/javascript">
		var prefix = ctx + "poem";
		$(function() {
		    var options = {
		        url: prefix + "/poem/list",
		        sortName: "id",
		        sortOrder: "asc",
		        showSearch: false,
		        showRefresh: false,
		        showToggle: false,
		        showColumns: false,
		        clickToSelect: true,
		        columns: [{
		            checkbox: true
		        },
		        {
		            field: 'id',
		            title: '诗词ID',
		            width: '10%',
		            sortable: true
		        },
		        {
		            field: 'mingcheng',
		            title: '名称',
		            width: '20%',
		            sortable: true
		        },
		        {
		            field: 'zuozhe',
		            title: '作者',
		            width: '20%',
		            sortable: true
		        },
		        {
		            field: 'zhaiyao',
		            title: '摘要时间',
		            width: '50%',
		            sortable: true
		        }]
		    };
		    $.table.init(options);
		});
		
		/* 导入表结构-选择表结构-提交 */
		function submitHandler() {
			var setId = $("#setId").val();
			var rows = $.table.selectColumns("id");
			if (rows.length == 0) {
       			$.modal.alertWarning("请至少选择一条记录");
       			return;
       		}
			var data = {"setId": setId, "poemIds": rows.join()};
			$.operate.save(prefix + "/poemsetdetail/saveImportPoem", data);
		}
	</script>
</body>
</html>